package com.qf.service.impl;

import com.qf.mapper.CarMapper;
import com.qf.pojo.Car;
import com.qf.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.Liu
 * @date 2021/12/15 20:14
 */
@Service
public class CarServiceImpl implements CarService {
    @Autowired
    private CarMapper carMapper;

    /**
     * 通过价格查询车辆
     * @param getid
     * @return
     */
    @Override
    public List<Car> findCarsByMoney(Integer getid) {
        List<Car> cars = carMapper.findCarsByMoney(getid);
        if(cars!=null){
            return cars;
        }
        return null;
    }

    /**
     * 通过热度查询车辆
     * @param getid
     * @return
     */
    @Override
    public List<Car> findCarsByHot(Integer getid) {
        List<Car> cars = carMapper.findCarsByHot(getid);
        if(cars!=null){
            return cars;
        }
        return null;
    }

    /**
     * 查询车辆信息
     * @param cid
     * @return
     */
    @Override
    public Car findCarById(Integer cid) {
        Car car = carMapper.findCarById(cid);
        if(car!=null){
            return car;
        }
        return null;
    }
}
